package com.code.pattern.observer;

/**
 * @author: liyufei
 * @date: 2021-04-03 21:59
 */
public class ObserverTest {

    public static void main(String[] args) {
        // 创建一个主题
        Sport3DSubject subject = new Sport3DSubject();

        // 创建三个观察者
        ObserverPerson p1 = new ObserverPerson("盖伦", subject);
        ObserverPerson p2 = new ObserverPerson("压缩", subject);
        ObserverPerson p3 = new ObserverPerson("赵信", subject);

        // 赵信 取消订阅
        subject.removeObserver(p3);

        // 开奖通知
        subject.notifyObserver("您好，本期的开奖结果是：01 29 30 58 37 10");
    }
}
